<?php

/**
 * This is the model class for table "industripengeluaran".
 *
 * The followings are the available columns in table 'industripengeluaran':
 * @property integer $ip_id
 * @property string $ip_kodejenis
 * @property integer $ip_bahanbaku
 * @property integer $ip_bahanbakar
 * @property integer $ip_jasaindustri
 * @property integer $ip_lain
 * @property integer $ip_jumlah
 * @property integer $ip_tahun
 */
class Industripengeluaran extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Industripengeluaran the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'industripengeluaran';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ip_bahanbaku, ip_bahanbakar, ip_jasaindustri, ip_lain, ip_jumlah, ip_tahun', 'numerical', 'integerOnly'=>true),
			array('ip_kodejenis', 'length', 'max'=>128),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ip_id, ip_kodejenis, ip_bahanbaku, ip_bahanbakar, ip_jasaindustri, ip_lain, ip_jumlah, ip_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ip_id' => 'Ip',
			'ip_kodejenis' => 'Jenis Industri',
			'ip_bahanbaku' => 'Bahan Baku dan Penolong',
			'ip_bahanbakar' => 'Bahan Bakar, Pelumas, dan Listrik',
			'ip_jasaindustri' => 'Jasa Industri',
			'ip_lain' => 'Lainnya',
			'ip_jumlah' => 'Jumlah',
			'ip_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ip_id',$this->ip_id);
		$criteria->compare('ip_kodejenis',$this->ip_kodejenis,true);
		$criteria->compare('ip_bahanbaku',$this->ip_bahanbaku);
		$criteria->compare('ip_bahanbakar',$this->ip_bahanbakar);
		$criteria->compare('ip_jasaindustri',$this->ip_jasaindustri);
		$criteria->compare('ip_lain',$this->ip_lain);
		$criteria->compare('ip_jumlah',$this->ip_jumlah);
		$criteria->compare('ip_tahun',$this->ip_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}